// This file was generated by Rcpp::compileAttributes
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#include "../inst/include/eliot.h"
#include <RcppArmadillo.h>
#include <Rcpp.h>
#include <string>
#include <set>

using namespace Rcpp;

// CARIRTcpp
Rcpp::List CARIRTcpp(SEXP ConnectMatrix, SEXP VoteMatrix, SEXP nonUnanimous, SEXP InitialAveragePrefs, SEXP InitialAlphas, SEXP InitialBetas, SEXP SaveChains, SEXP BurntIterations, SEXP SavedIterations, SEXP ThinningFactor);
RcppExport SEXP eliot_CARIRTcpp(SEXP ConnectMatrixSEXP, SEXP VoteMatrixSEXP, SEXP nonUnanimousSEXP, SEXP InitialAveragePrefsSEXP, SEXP InitialAlphasSEXP, SEXP InitialBetasSEXP, SEXP SaveChainsSEXP, SEXP BurntIterationsSEXP, SEXP SavedIterationsSEXP, SEXP ThinningFactorSEXP) {
BEGIN_RCPP
    Rcpp::RObject __result;
    Rcpp::RNGScope __rngScope;
    Rcpp::traits::input_parameter< SEXP >::type ConnectMatrix(ConnectMatrixSEXP);
    Rcpp::traits::input_parameter< SEXP >::type VoteMatrix(VoteMatrixSEXP);
    Rcpp::traits::input_parameter< SEXP >::type nonUnanimous(nonUnanimousSEXP);
    Rcpp::traits::input_parameter< SEXP >::type InitialAveragePrefs(InitialAveragePrefsSEXP);
    Rcpp::traits::input_parameter< SEXP >::type InitialAlphas(InitialAlphasSEXP);
    Rcpp::traits::input_parameter< SEXP >::type InitialBetas(InitialBetasSEXP);
    Rcpp::traits::input_parameter< SEXP >::type SaveChains(SaveChainsSEXP);
    Rcpp::traits::input_parameter< SEXP >::type BurntIterations(BurntIterationsSEXP);
    Rcpp::traits::input_parameter< SEXP >::type SavedIterations(SavedIterationsSEXP);
    Rcpp::traits::input_parameter< SEXP >::type ThinningFactor(ThinningFactorSEXP);
    __result = Rcpp::wrap(CARIRTcpp(ConnectMatrix, VoteMatrix, nonUnanimous, InitialAveragePrefs, InitialAlphas, InitialBetas, SaveChains, BurntIterations, SavedIterations, ThinningFactor));
    return __result;
END_RCPP
}
// LDAIRTcpp
Rcpp::List LDAIRTcpp(SEXP WordMatrixDocs, SEXP WordMatrixTerms, SEXP WordMatrixCounts, SEXP VoteMatrix, SEXP LDAtopics, SEXP LDAterms, SEXP LDAwords, SEXP LDAdocterms, SEXP LDAalpha, SEXP LDAbeta, SEXP IRTprec, SEXP StartIdealPoints, SEXP SaveChains, SEXP BurntIterations, SEXP SavedIterations);
RcppExport SEXP eliot_LDAIRTcpp(SEXP WordMatrixDocsSEXP, SEXP WordMatrixTermsSEXP, SEXP WordMatrixCountsSEXP, SEXP VoteMatrixSEXP, SEXP LDAtopicsSEXP, SEXP LDAtermsSEXP, SEXP LDAwordsSEXP, SEXP LDAdoctermsSEXP, SEXP LDAalphaSEXP, SEXP LDAbetaSEXP, SEXP IRTprecSEXP, SEXP StartIdealPointsSEXP, SEXP SaveChainsSEXP, SEXP BurntIterationsSEXP, SEXP SavedIterationsSEXP) {
BEGIN_RCPP
    Rcpp::RObject __result;
    Rcpp::RNGScope __rngScope;
    Rcpp::traits::input_parameter< SEXP >::type WordMatrixDocs(WordMatrixDocsSEXP);
    Rcpp::traits::input_parameter< SEXP >::type WordMatrixTerms(WordMatrixTermsSEXP);
    Rcpp::traits::input_parameter< SEXP >::type WordMatrixCounts(WordMatrixCountsSEXP);
    Rcpp::traits::input_parameter< SEXP >::type VoteMatrix(VoteMatrixSEXP);
    Rcpp::traits::input_parameter< SEXP >::type LDAtopics(LDAtopicsSEXP);
    Rcpp::traits::input_parameter< SEXP >::type LDAterms(LDAtermsSEXP);
    Rcpp::traits::input_parameter< SEXP >::type LDAwords(LDAwordsSEXP);
    Rcpp::traits::input_parameter< SEXP >::type LDAdocterms(LDAdoctermsSEXP);
    Rcpp::traits::input_parameter< SEXP >::type LDAalpha(LDAalphaSEXP);
    Rcpp::traits::input_parameter< SEXP >::type LDAbeta(LDAbetaSEXP);
    Rcpp::traits::input_parameter< SEXP >::type IRTprec(IRTprecSEXP);
    Rcpp::traits::input_parameter< SEXP >::type StartIdealPoints(StartIdealPointsSEXP);
    Rcpp::traits::input_parameter< SEXP >::type SaveChains(SaveChainsSEXP);
    Rcpp::traits::input_parameter< SEXP >::type BurntIterations(BurntIterationsSEXP);
    Rcpp::traits::input_parameter< SEXP >::type SavedIterations(SavedIterationsSEXP);
    __result = Rcpp::wrap(LDAIRTcpp(WordMatrixDocs, WordMatrixTerms, WordMatrixCounts, VoteMatrix, LDAtopics, LDAterms, LDAwords, LDAdocterms, LDAalpha, LDAbeta, IRTprec, StartIdealPoints, SaveChains, BurntIterations, SavedIterations));
    return __result;
END_RCPP
}
// LIRTcpp
Rcpp::List LIRTcpp(SEXP LambdaMatrix, SEXP VoteMatrix, SEXP IRTprec, SEXP StartIdealPoints, SEXP SaveChains, SEXP BurntIterations, SEXP SavedIterations);
RcppExport SEXP eliot_LIRTcpp(SEXP LambdaMatrixSEXP, SEXP VoteMatrixSEXP, SEXP IRTprecSEXP, SEXP StartIdealPointsSEXP, SEXP SaveChainsSEXP, SEXP BurntIterationsSEXP, SEXP SavedIterationsSEXP) {
BEGIN_RCPP
    Rcpp::RObject __result;
    Rcpp::RNGScope __rngScope;
    Rcpp::traits::input_parameter< SEXP >::type LambdaMatrix(LambdaMatrixSEXP);
    Rcpp::traits::input_parameter< SEXP >::type VoteMatrix(VoteMatrixSEXP);
    Rcpp::traits::input_parameter< SEXP >::type IRTprec(IRTprecSEXP);
    Rcpp::traits::input_parameter< SEXP >::type StartIdealPoints(StartIdealPointsSEXP);
    Rcpp::traits::input_parameter< SEXP >::type SaveChains(SaveChainsSEXP);
    Rcpp::traits::input_parameter< SEXP >::type BurntIterations(BurntIterationsSEXP);
    Rcpp::traits::input_parameter< SEXP >::type SavedIterations(SavedIterationsSEXP);
    __result = Rcpp::wrap(LIRTcpp(LambdaMatrix, VoteMatrix, IRTprec, StartIdealPoints, SaveChains, BurntIterations, SavedIterations));
    return __result;
END_RCPP
}
// rcat
int rcat(Rcpp::NumericVector pvec);
static SEXP eliot_rcat_try(SEXP pvecSEXP) {
BEGIN_RCPP
    Rcpp::RObject __result;
    Rcpp::traits::input_parameter< Rcpp::NumericVector >::type pvec(pvecSEXP);
    __result = Rcpp::wrap(rcat(pvec));
    return __result;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP eliot_rcat(SEXP pvecSEXP) {
    SEXP __result;
    {
        Rcpp::RNGScope __rngScope;
        __result = PROTECT(eliot_rcat_try(pvecSEXP));
    }
    Rboolean __isInterrupt = Rf_inherits(__result, "interrupted-error");
    if (__isInterrupt) {
        UNPROTECT(1);
        Rf_onintr();
    }
    Rboolean __isError = Rf_inherits(__result, "try-error");
    if (__isError) {
        SEXP __msgSEXP = Rf_asChar(__result);
        UNPROTECT(1);
        Rf_error(CHAR(__msgSEXP));
    }
    UNPROTECT(1);
    return __result;
}
// rutnorm
double rutnorm(double mean, double sd, double ub);
static SEXP eliot_rutnorm_try(SEXP meanSEXP, SEXP sdSEXP, SEXP ubSEXP) {
BEGIN_RCPP
    Rcpp::RObject __result;
    Rcpp::traits::input_parameter< double >::type mean(meanSEXP);
    Rcpp::traits::input_parameter< double >::type sd(sdSEXP);
    Rcpp::traits::input_parameter< double >::type ub(ubSEXP);
    __result = Rcpp::wrap(rutnorm(mean, sd, ub));
    return __result;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP eliot_rutnorm(SEXP meanSEXP, SEXP sdSEXP, SEXP ubSEXP) {
    SEXP __result;
    {
        Rcpp::RNGScope __rngScope;
        __result = PROTECT(eliot_rutnorm_try(meanSEXP, sdSEXP, ubSEXP));
    }
    Rboolean __isInterrupt = Rf_inherits(__result, "interrupted-error");
    if (__isInterrupt) {
        UNPROTECT(1);
        Rf_onintr();
    }
    Rboolean __isError = Rf_inherits(__result, "try-error");
    if (__isError) {
        SEXP __msgSEXP = Rf_asChar(__result);
        UNPROTECT(1);
        Rf_error(CHAR(__msgSEXP));
    }
    UNPROTECT(1);
    return __result;
}
// rltnorm
double rltnorm(double mean, double sd, double lb);
static SEXP eliot_rltnorm_try(SEXP meanSEXP, SEXP sdSEXP, SEXP lbSEXP) {
BEGIN_RCPP
    Rcpp::RObject __result;
    Rcpp::traits::input_parameter< double >::type mean(meanSEXP);
    Rcpp::traits::input_parameter< double >::type sd(sdSEXP);
    Rcpp::traits::input_parameter< double >::type lb(lbSEXP);
    __result = Rcpp::wrap(rltnorm(mean, sd, lb));
    return __result;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP eliot_rltnorm(SEXP meanSEXP, SEXP sdSEXP, SEXP lbSEXP) {
    SEXP __result;
    {
        Rcpp::RNGScope __rngScope;
        __result = PROTECT(eliot_rltnorm_try(meanSEXP, sdSEXP, lbSEXP));
    }
    Rboolean __isInterrupt = Rf_inherits(__result, "interrupted-error");
    if (__isInterrupt) {
        UNPROTECT(1);
        Rf_onintr();
    }
    Rboolean __isError = Rf_inherits(__result, "try-error");
    if (__isError) {
        SEXP __msgSEXP = Rf_asChar(__result);
        UNPROTECT(1);
        Rf_error(CHAR(__msgSEXP));
    }
    UNPROTECT(1);
    return __result;
}
// rdtnorm
double rdtnorm(double mean, double sd, double lb, double ub);
static SEXP eliot_rdtnorm_try(SEXP meanSEXP, SEXP sdSEXP, SEXP lbSEXP, SEXP ubSEXP) {
BEGIN_RCPP
    Rcpp::RObject __result;
    Rcpp::traits::input_parameter< double >::type mean(meanSEXP);
    Rcpp::traits::input_parameter< double >::type sd(sdSEXP);
    Rcpp::traits::input_parameter< double >::type lb(lbSEXP);
    Rcpp::traits::input_parameter< double >::type ub(ubSEXP);
    __result = Rcpp::wrap(rdtnorm(mean, sd, lb, ub));
    return __result;
END_RCPP_RETURN_ERROR
}
RcppExport SEXP eliot_rdtnorm(SEXP meanSEXP, SEXP sdSEXP, SEXP lbSEXP, SEXP ubSEXP) {
    SEXP __result;
    {
        Rcpp::RNGScope __rngScope;
        __result = PROTECT(eliot_rdtnorm_try(meanSEXP, sdSEXP, lbSEXP, ubSEXP));
    }
    Rboolean __isInterrupt = Rf_inherits(__result, "interrupted-error");
    if (__isInterrupt) {
        UNPROTECT(1);
        Rf_onintr();
    }
    Rboolean __isError = Rf_inherits(__result, "try-error");
    if (__isError) {
        SEXP __msgSEXP = Rf_asChar(__result);
        UNPROTECT(1);
        Rf_error(CHAR(__msgSEXP));
    }
    UNPROTECT(1);
    return __result;
}
// wordfishcpp
Rcpp::List wordfishcpp(SEXP wfm, SEXP dir, SEXP priors, SEXP tol);
RcppExport SEXP eliot_wordfishcpp(SEXP wfmSEXP, SEXP dirSEXP, SEXP priorsSEXP, SEXP tolSEXP) {
BEGIN_RCPP
    Rcpp::RObject __result;
    Rcpp::RNGScope __rngScope;
    Rcpp::traits::input_parameter< SEXP >::type wfm(wfmSEXP);
    Rcpp::traits::input_parameter< SEXP >::type dir(dirSEXP);
    Rcpp::traits::input_parameter< SEXP >::type priors(priorsSEXP);
    Rcpp::traits::input_parameter< SEXP >::type tol(tolSEXP);
    __result = Rcpp::wrap(wordfishcpp(wfm, dir, priors, tol));
    return __result;
END_RCPP
}

// validate (ensure exported C++ functions exist before calling them)
static int eliot_RcppExport_validate(const char* sig) { 
    static std::set<std::string> signatures;
    if (signatures.empty()) {
        signatures.insert("int(*rcat)(Rcpp::NumericVector)");
        signatures.insert("double(*rutnorm)(double,double,double)");
        signatures.insert("double(*rltnorm)(double,double,double)");
        signatures.insert("double(*rdtnorm)(double,double,double,double)");
    }
    return signatures.find(sig) != signatures.end();
}

// registerCCallable (register entry points for exported C++ functions)
RcppExport SEXP eliot_RcppExport_registerCCallable() { 
    R_RegisterCCallable("eliot", "eliot_rcat", (DL_FUNC)eliot_rcat_try);
    R_RegisterCCallable("eliot", "eliot_rutnorm", (DL_FUNC)eliot_rutnorm_try);
    R_RegisterCCallable("eliot", "eliot_rltnorm", (DL_FUNC)eliot_rltnorm_try);
    R_RegisterCCallable("eliot", "eliot_rdtnorm", (DL_FUNC)eliot_rdtnorm_try);
    R_RegisterCCallable("eliot", "eliot_RcppExport_validate", (DL_FUNC)eliot_RcppExport_validate);
    return R_NilValue;
}
